using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter22
{
	/// <summary>
	/// Example09: Calculating \Delta S for a Calorimetric Process
	/// Suppose that 1.0 kg of water at 0 C is mixed with an equal
	/// mass of water at 100 C. After equilibrium is reached, the
	/// mixture has a uniform temperature of 50 C. What is the 
	/// change in entropy of the system?
	/// \Delta S = 102 J/K
	/// </summary>
	public class Example09
	{
		public Example09()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Temperature T1 = new L.Temperature();
			T1.K = 0.0+273.0;
			L.Temperature T2 = new L.Temperature();
			T2.K = 100.0+273.0;
			L.Temperature Tf = new L.Temperature();
			Tf.K = 50.0+273.0;
			L.Mass m = new L.Mass();
			m.kg = 1.0;
			L.SpecificHeat c = new L.SpecificHeat();
			c.JPERkgPERCelsius = 4186.0;
			L.Entropy S = new L.Entropy();
			S.JPERK = m.kg*c.JPERkgPERCelsius
				*Math.Log(Tf.K/T1.K*Tf.K/T2.K);
			result+=Convert.ToString(S.JPERK);
		}
	}
}
